package com.sy.core.util;

import java.util.Random;

public class SysConst {
	public static final String USERNAME="^.{1,25}$";
	public static  final String BASE_PATH = "E:\\upload\\pic";
	/**
	 * 手机号格式校验正则表达式
	 */
	public static final String PHONE_REG = "^[1][2,3,4,5,6,7,8,9][0-9]{9}$";
	/**
	 * 中文校验
	 */
	public static final String ZHONGWEN_REG = "[\u4e00-\u9fa5]";
	/**
	 * 邮箱校验
	 */
	public static final String MAIL = "^[a-z0-9]+([._\\-]*[a-z0-9])*@([a-z0-9]+[-a-z0-9]*[a-z0-9]+.){1,63}[a-z0-9]+$";
	//15位和18位身份证号码的正则表达式
	public static final  String REGEX_ID_CARD = "(^\\d{18}$)|(^\\d{15}$)";

	/**
	 * 常数校验 只接受 0 1
	 * 
	 */
	public static final String SEX = "^[12]$";
	/**
	 * 密码校验 (大写字母小写字母数字三者都要出现 6-12位)
	 */
	public static final String PASSWORD = "^\\w+$";
	/**
	 * 交易密码校验
	 */
	public static final String PASSWORD_PAY = "^(?:(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])).{8,12}$";
	/**
	 * 账户名校验4到16位(字母，数字，下划线，减号)
	 */
	public static final String ACCOUNT = "^[a-zA-Z0-9_-]{4,16}$";
	/**
	 * 日期格式校验
	 */
	public static final String DATE = "^(?:(?!0000)[0-9]{4}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-8])|(?:0[13-9]|1[0-2])-(?:29|30)|(?:0[13578]|1[02])-31)|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00)-02-29)$";
	/**
	 * 手机格式校验
	 */
	public static final String PHONE = "^[1][3,4,5,7,8][0-9]{9}$";

	public static final String REDIS_USER_SESSION_KEY = "AUTOTEST_";
	/**
	 * redis验证码主键
	 */
	public static final String REDIS_USER_VALIDATIONCODE_KEY = "CODEPHONE_";

	public static final String CASE_BANDING_ = "CASE_BANDING_";


	/**
	 * 分页参数 当前页默认值
	 */
	public static final String PAGENO = "1";
	/**
	 * 分页参数 每页条数
	 */
	public static final String PAGESIZE = "15";

	/**
	 * 短信验证码
	 *
	 * @param charCount
	 * @return
	 */
	public static String getRandNum(int charCount) {
		String charValue = "";
		for (int i = 0; i < charCount; i++) {
			char c = (char) (randomInt(0, 10) + '0');
			charValue += String.valueOf(c);
		}
		return charValue;

	}
	public static int randomInt(int from, int to) {
		Random r = new Random();
		return from + r.nextInt(to - from);
	}

	public static String randomString() {
		String result = "";
		for (int i = 0; i < 6; ++i) {
			int intVal = (int) (Math.random() * 26 + 97);
			result = result + (char) intVal;
		}
		return result;
	}


}
